#有NumPy购物数据如下：
import numpy as np
## Data: row is customer shopping basket
## row = [course 1, course 2, ebook 1, ebook 2]
## value 1 indicates that an item was bought.
basket = np.array([[0, 1, 1, 0],
                   [0, 0, 0, 1],
                   [1, 1, 0, 0],
                   [0, 1, 1, 1],
                   [1, 1, 1, 0],
                   [0, 1, 1, 0],
                   [1, 1, 0, 1],
                   [1, 1, 1, 1]])
#多少比例的顾客会同时购买ebook 1和ebook 2？
def calc():
    #TODO:
    return np.sum(np.all(basket[:, 2:], axis = 1)) / basket.shape[0]

def test_calc():
    assert calc() == 0.25
